package com.example.duanjunjie.learn.json;

import com.google.gson.TypeAdapter;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;

/**
 * Created by duanjunjie on 2018/3/20.
 */

public class GsonTestDataAdapter extends TypeAdapter<GsonTestData> {

    @Override
    public void write(JsonWriter out, GsonTestData value) throws IOException {

    }

    @Override
    public GsonTestData read(JsonReader in) throws IOException {
        GsonTestData data = new GsonTestData();
        try {
            data.read(in);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return data;
    }
}
